package com.whd.domain;

import lombok.Data;

@Data
public class ResultVo {
    private Integer code;
    private String msg;
    private Object data;

    public ResultVo(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static ResultVo success(String msg) {
        return new ResultVo(200, msg, null);
    }

    public static ResultVo success(String msg, Object data) {
        return new ResultVo(200, msg, data);
    }

    public static ResultVo success(Object data) {
        return new ResultVo(200, "成功", data);
    }

    public static ResultVo fail(String msg) {
        return new ResultVo(500, msg, null);
    }

    public static ResultVo fail(Integer code, String msg) {
        return new ResultVo(code, msg, null);
    }

    public static ResultVo fail(String msg, Object data) {
        return new ResultVo(500, msg, data);
    }

    public static ResultVo fail(Object data) {
        return new ResultVo(500, "失败", data);
    }
}
